<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/ui/";
%>

<!DOCTYPE HTML>
<html>
<head>
<base href="<%=basePath%>">
<title>观看实验</title>
<link href="css/bootstrap.css" rel="stylesheet" type="text/css"
	media="all" />
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="js/jquery.min.js"></script>
<!-- Custom Theme files -->
<!--theme-style-->
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
<!--//theme-style-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords"
	content="New Store Responsive web template, Bootstrap Web Templates, Flat Web Templates, Andriod Compatible web template, 
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyErricsson, Motorola web design" />
<script type="application/x-javascript">
	
	
	
	
	
	
	 addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } 






</script>
<!--fonts-->
<!--//fonts-->
<!-- start menu -->
<link href="css/memenu.css" rel="stylesheet" type="text/css" media="all" />
 <link href="../home/css/charisma-app.css" rel="stylesheet">
<script type="text/javascript" src="js/memenu.js"></script>

<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>

<script>
	$(document).ready(function() {
		$(".memenu").memenu();
	});
</script>


<script src="js/main.js"></script>
<script src="js/simpleCart.min.js"></script>
<script type="text/javascript">
	function checkform() {
		var pstr = $("#pstr").val();
		var uid = $("#uid").attr("value");
		var flag = true;
		if (uid == "") {
			flag = false;
			alert("请先登录在发表自己的实验心得");
			return flag;
		} else if (pstr.trim() == "") {
			flag = false;
			alert("请先填写实验心得");
			return flag;
		} else {
		//	window.opener.location.reload();
			flag = true;
			return flag;
		}
		/*
		$.ajax({
			type : "POST",
			url : "/sypt/VideoServlet",
			async : false,
			dataType : "text",
			data : {
				"method" : "addComment",
				"uid" : uid,
				"pstr" : pstr,
				

			},
			success : function(data) {
				//刷新页面
			}
		});*/

	}
</script>
<script type="text/javascript">
	function hfpl() {
		var uid = $("#uid").attr("value");
		var flag = true;
		if (uid == "") {
			flag = false;
			alert("请登录再回复该评论");
		}

		return flag;
	}
</script>
<!--下一题  -->
<script type="text/javascript">
	function nextproblems(value) {
		var uid = $("#uid").attr("value");
		var spid = $("#spid").attr("value");
		var nid = $("#nid").html();
		
		var flag = true;
		if (uid == "") {
			flag = false;
			alert("请登录再答题");
			return flag;
		}
		////ajax刷新题目
		$.ajax({
			type : "POST",
			url : "/sypt/VideoServlet",
			async : false,
			dataType : "json",
			data : {
				"method" : "findByExam",
				"nid" : nid,
				"spid": spid
			},
			success : function(data) {
				if (data==null) {
					alert("题目已经答完了，请不要再点了！");
				} else {
					nid=parseInt(nid)+1;
					
					$("#nid").html(nid);
					$("#ttm").html(data.ttm);
					$("#ta").html("A."+data.ta);
					$("#tb").html("B."+data.tb);
					$("#tc").html("C."+data.tc);
					$("#td").html("D."+data.td);
					$("#tda").html("正确答案为:"+data.tda);
					$("#tda").css("display","none");
				}
			}
		});

	}
</script>
<!-- 显示答案 -->
<script type="text/javascript">
	function showda() {
		var uid = $("#uid").attr("value");
		var spid = $("#spid").attr("value");
		var flag = true;
		if (uid == "") {
			flag = false;
			alert("请登录再答题");
			return flag;
		}else{
			$("#tda").css("display","");
		}
		

	}
</script>


<!--  -->
<script type="text/javascript">
	function dianzan(value) {
		var uid = $("#uid").attr("value");
		var spid = $("#spid").attr("value");
		var flag = true;
		if (uid == "") {
			flag = false;
			alert("请登录再收藏该实验");
			return flag;
		}
		////ajax刷新收藏数
		$.ajax({
			type : "POST",
			url : "/sypt/VideoServlet",
			async : false,
			dataType : "text",
			data : {
				"method" : "dianzan",
				"uid" : uid,
				"spid" : spid,
				"value" : value

			},
			success : function(data) {
				if (data == "") {
					alert("您已经收藏过该视频，请不要重复收藏！");
				} else {
					var dianzan = data + "次收藏";
					$("#dianzan").html(dianzan);
				}
			}
		});

	}
</script>
<script type="text/javascript">
	function xiazai() {
		var uid = $("#uid").attr("value");
		var spid = $("#spid").attr("value");
		//var spurl="${video.spurl}";
		var flag = true;
		if (uid == "") {
			flag = false;
			alert("请登录再下载实验视频");
			return flag;
		}

		$.ajax({
			type : "POST",
			url : "/sypt/VideoServlet",
			async : false,
			dataType : "text",
			data : {
				"method" : "updatedown",
				"spid" : spid
			},
			success : function(data) {
			//	window.opener.location.reload();
				if (data == "") {
					alert("下载失败");
				} else {
					var down = data + "次下载";
					$("#downloadid").html(down);
				}
			}
		});
	}
</script>
<script type="text/javascript">
	function xiazaiwendang() {
		var uid = $("#uid").attr("value");
		var spid = $("#spid").attr("value");
		//var spurl="${video.spurl}";
		var flag = true;
		if (uid == "") {
			flag = false;
			alert("请登录再下载实验相关文档");
			
			
			return flag;
		}
		
		$.ajax({
			type : "POST",
			url : "/sypt/VideoServlet",
			async : false,
			dataType : "text",
			data : {
				"method" : "updatedown",
				"spid" : spid
			},
			success : function(data) {
				
				if (data == "") {
					alert("下载失败");
				} else {

				}
			}
		});
	}
</script>

</head>
<body>
	<!--header-->
	<%@include file="/ui/head.jsp"%>


	<!--content-->
	<!---->
	<div class="product">
		<div class="container">
			<div class="col-md-3 product-price">
				<div class=" rsidebar span_1_of_left">
					<div class="of-left">
						<h3 class="cate">实验分类</h3>
					</div>
					<ul class="menu">
						<c:forEach items="${sessionScope.list1 }" var="list1">
							<li class="item1"><a
								href="<c:url value='/BcategoryServlet?method=findByaid&aid=${list1.aid }'/>">${list1.aname }
							</a>
								<ul class="cute">
									<c:forEach items="${list1.bcategory }" var="list2">
										<li class="subitem1"><a
											href="<c:url value='/VideoServlet?method=findBybid&bid=${list2.bid }'/>">${list2.bname }
										</a></li>
									</c:forEach>
								</ul></li>
						</c:forEach>
					</ul>
				</div>

				<!--initiate accordion-->
				<script type="text/javascript">
					$(function() {
						var menu_ul = $('.menu > li > ul'), menu_a = $('.menu > li > a');
						menu_ul.hide();
						menu_a.click(function(e) {
							e.preventDefault();
							if (!$(this).hasClass('active')) {
								menu_a.removeClass('active');
								menu_ul.filter(':visible').slideUp('normal');
								$(this).addClass('active').next().stop(true,
										true).slideDown('normal');
							} else {
								$(this).removeClass('active');
								$(this).next().stop(true, true).slideUp(
										'normal');
							}
						});

					});
				</script>
				<!---->


				<!---->
				<div class="product-bottom">
					<div class="of-left-in">
						<h3 class="best">猜你喜欢</h3>
					</div>
					<c:forEach items="${tuijian }" var="tuijian">
					<div class="product-go">
						<div class=" fashion-grid" style="width: 100%">
<span class=" price-in1"> <a href="<c:url value='/VideoServlet?method=findByspid&spid=${tuijian.spid }'/>">${tuijian.spname }</a></span>
							<h6 class="best2">
								上传者：${tuijian.uname }
							</h6>
						</div>
						

						<div class="clearfix"></div>
					</div>
					</c:forEach>
					
					

				</div>
				<div class=" per1"></div>
			</div>
			<!-- 视频播放 -->
			<div class="col-md-9 product-price1">

				<div class="col-md-7 single-top-in simpleCart_shelfItem">
					<div class="single-para ">
						<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
							width="800" height="405" id="FlashID" title="实验视频">
							<param name="movie" value="video/${video.spurl }" />
							<param name="quality" value="high" />
							<param name="wmode" value="opaque" />
							<param name="swfversion" value="7.0.70.0" />
							<!-- 此 param 标签提示使用 Flash Player 6.0 r65 和更高版本的用户下载最新版本的 Flash Player。如果您不想让用户看到该提示，请将其删除。 -->
							<param name="expressinstall" value="Scripts/expressInstall.swf" />
							<!-- 下一个对象标签用于非 IE 浏览器。所以使用 IECC 将其从 IE 隐藏。 -->
							<!--[if !IE]>-->
							<object type="application/x-shockwave-flash"
								data="video/${video.spurl }" width="800" height="405">
								<!--<![endif]-->
								<param name="quality" value="high" />
								<param name="wmode" value="opaque" />
								<param name="swfversion" value="7.0.70.0" />
								<param name="expressinstall" value="Scripts/expressInstall.swf" />
								<!-- 浏览器将以下替代内容显示给使用 Flash Player 6.0 和更低版本的用户。 -->
								<div>
									<h4>此页面上的内容需要较新版本的 Adobe Flash Player。</h4>
									<p>
										<a href="http://www.adobe.com/go/getflashplayer"><img
											src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
											alt="获取 Adobe Flash Player" width="112" height="33" /></a>
									</p>
								</div>
								<!--[if !IE]>-->
							</object>
							<!--<![endif]-->
						</object>


						<script type="text/javascript">
							swfobject.registerObject("FlashID");
						</script>

						<a id="downloadid" href="javascript:void(0)"
							class="add-cart item_add">${video.spxz }次下载</a> <a id="dianzan"
							href="javascript:void(0)" class="add-cart item_add">${video.spdz }次收藏</a>
							
						<c:choose>
							<c:when test="${empty video.zan }">
								<a href="javascript:void(0)" class="add-cart item_add"
									onclick="return dianzan(1);">收藏</a>
							</c:when>
							<c:otherwise>
								<a href="javascript:void(0)" class="add-cart item_add"
									onclick="return dianzan(-1);">取消收藏</a>
							</c:otherwise>
						</c:choose>


					</div>
				</div>
				<div class="clearfix"></div>
				
				<!---->
				<div class="cd-tabs">
					<nav>
						本实验演示视频均由网友自主上传，如果对您造成侵权，请联系管理员，我们将及时处理
					<ul class="cd-tabs-navigation">

						<li><a
							href="<c:url value='/VideoServlet?method=downloadfile&uid=${sessionScope.user.uid }&spid=${video.spid }&spwdurl=${video.spwdurl }'/>"
							onclick="return xiazaiwendang();">实验相关文档下载</a></li>
						<li><a data-content="television"
							href="<c:url value='/VideoServlet?method=download&uid=${sessionScope.user.uid }&spid=${video.spid }&spurl=${video.spurl }'/>"
							class="selected " onclick="return xiazai();">实验视频下载</a></li>

					</ul>
					</nav>
					<ul class="cd-tabs-content">


						<!-- 实验内容简介 -->
						<li data-content="television" class="selected">
								<a class="add-re" href="javascript:void(0)">实验简介</a>
							<div class="comments-top-top">
								<div class="top-comment-right" style="width: 800">
									<h6>
										<a href="javascript:void(0)">实验发布者:</a> ${video.uname }
									</h6>
									<h6>
										<a href="javascript:void(0)">发布时间:</a> ${video.sptime }
									</h6>

									<p>${video.spstr }</p>
								</div>
								<div class="clearfix"></div>
								
							</div>

						</li>
						<!-- 习题 -->
						<c:if test="${not empty video.exam }">
						<li data-content="television" class="selected">
								<a class="add-re" href="javascript:void(0)">实验习题</a>
							<div class="comments-top-top">
								<div class="top-comment-right" style="width: 800">
									<h6>第<a id="nid">1</a>题</h6>
									<p id="ttm">${video.exam.ttm }</p>
								<a id="ta" class="add-re" href="javascript:void(0)" onclick="return showda();">A.${video.exam.ta }</a>
								<a id="tb" class="add-re" href="javascript:void(0)" onclick="return showda();">B.${video.exam.tb }</a>
								<a id="tc" class="add-re" href="javascript:void(0)" onclick="return showda();">C.${video.exam.tc }</a>
								<a id="td" class="add-re" href="javascript:void(0)" onclick="return showda();">D.${video.exam.td }</a>
								<a id="a" class="add-re" href="javascript:void(0)" style="margin-right: 2" onclick="return nextproblems();">下一题</a>
								<a id="tda" class="add-re" style="display: none" href="javascript:void(0)">正确答案为:${video.exam.tda }</a>
								
								</div>
								<div class="clearfix"></div>
							</div>
<a class="add-re" href="javascript:void(0)">实验心得</a>
						</li>
						</c:if>
						
						<!-- 评论区 -->
						<c:forEach items="${video.comlist }" var="comm">
							<li data-content="television" class="selected">
								<div class="comments-top-top">
									<div class="top-comment-left">
										<img width="70px" height="70px" src="../home/img/touxiang/${comm.user.uimage }"
											alt="">
									</div>
									<div class="top-comment-right">
										<h6>
											<a href="javascript:void(0)">${comm.user.uname }</a>
											${comm.ptime }
										</h6>

										<p>${comm.pstr }</p>
										<a class="add-re"
											href="<c:url value='/VideoServlet?method=findReply&count=1&cid=${comm.cid }'/>"
											onclick="return hfpl();">回复</a> <c:if test="${comm.count !=0 }"><span class="notification">${comm.count }</span></c:if>
									</div>
									<div class="clearfix"></div>
								</div>

							</li>
						</c:forEach>
						<li data-content="television" class="selected"><a
							class="add-re" href="javascript:void(0)">我的心得</a>
							<form name="form1" method="post"
								action="<c:url value='/VideoServlet'/>">
								<input type="hidden" name="method" value="addComment"> <input
									type="hidden" name="uid" id="uid"
									value="${sessionScope.user.uid }"> <input type="hidden"
									name="spid" id="spid" value="${video.spid }">
								<div class="comments-top-top">
									<div class="top-comment-left">
										<img width="70px" height="70px" src="images/co.png" alt="">
									</div>
									<div class="top-comment-right">
										<textarea name="pstr" id="pstr" cols="80" rows="5"></textarea>
									</div>
									<div class="clearfix"></div>
									<input class="add-re" type="submit"
										onclick="return checkform();" value="评论">

								</div>
							</form></li>

						<div class="clearfix"></div>
					</ul>
				</div>
				<div style="display: none" class=" bottom-product">
					<div class="col-md-4 bottom-cd simpleCart_shelfItem">
						<div class="product-at ">
							<a href="#"><img class="img-responsive" src="images/pi3.jpg"
								alt="">
								<div class="pro-grid">
									<span class="buy-in">Buy Now</span>
								</div> </a>
						</div>
						<p class="tun">It is a long established fact that a reader</p>
						<a href="#" class="item_add"><p class="number item_price">
								<i> </i>$500.00
							</p></a>
					</div>
					<div class="col-md-4 bottom-cd simpleCart_shelfItem">
						<div class="product-at ">
							<a href="#"><img class="img-responsive" src="images/pi1.jpg"
								alt="">
								<div class="pro-grid">
									<span class="buy-in">Buy Now</span>
								</div> </a>
						</div>
						<p class="tun">It is a long established fact that a reader</p>
						<a href="#" class="item_add"><p class="number item_price">
								<i> </i>$500.00
							</p></a>
					</div>
					<div class="col-md-4 bottom-cd simpleCart_shelfItem">
						<div class="product-at ">
							<a href="#"><img class="img-responsive" src="images/pi4.jpg"
								alt="">
								<div class="pro-grid">
									<span class="buy-in">Buy Now</span>
								</div> </a>
						</div>
						<p class="tun">It is a long established fact that a reader</p>
						<a href="#" class="item_add"><p class="number item_price">
								<i> </i>$500.00
							</p></a>
					</div>
					<div class="clearfix"></div>
				</div>
			</div>

			<div class="clearfix"></div>
		</div>
	</div>
	<!--//content-->
	<%@include file="/ui/foot.jsp"%>
</body>
</html>
